package saima;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

/**
 * @author MaoLin Wang
 * @date 2020/4/1711:45
 */
public class Police {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int num=scanner.nextInt();
        String str=scanner.next();
        char[] chars = str.toCharArray();
        int[]xiaotou=new int[num];
        Map<Integer,Integer>police=new HashMap<Integer, Integer>(num);
        int xiaotouIndex=0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]=='X'){
                xiaotou[xiaotouIndex]=i;
                xiaotouIndex++;
            }else if (chars[i]=='#'){

            }else {
                police.put(i,Integer.parseInt(String.valueOf(chars[i])));
            }
        }
        int count=0;
        Set<Integer> p = police.keySet();
        for (Integer position:p){
            int x=police.get(position);
            for (int j = 0; j < xiaotouIndex ; j++) {
                if ( xiaotou[j]==-1){
                    continue;
                } else if (Math.abs(xiaotou[j]-position)<=x){
                    count++;
                    xiaotou[j]=-1;
                }
            }
        }
        System.out.println(count);
    }
}
